package org.snail.po.controller;

import org.apache.log4j.Logger;
import org.snail.exception.JsonResult;
import org.snail.po.bean.PoAttributeDO;
import org.snail.po.bean.PoCondition;
import org.snail.po.service.impl.PoAttributeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.commons.CommonsMultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;

@Controller
@RequestMapping("po")
public class PoController {
    public static final Logger LOGGER = Logger.getLogger(PoController.class);

    @Autowired
    private PoAttributeServiceImpl poAttributeService;



    /**
     * PO单Excel数据导入数据库
     *
     * @param file
     * @param request
     * @return
     */
    @RequestMapping("poExcelImport")
    @ResponseBody
    public JsonResult poExcelImport(@RequestParam("file") CommonsMultipartFile file, HttpServletRequest request) {
        JsonResult result = new JsonResult();
        poAttributeService.savePoExcelData(file, request);
        return result;
    }

}
